package com.jprocms.module.cms.enums;

import java.util.Arrays;

/**
 * @author jprocms
 */
public enum EnumTimeStage {

    day(1), week(2), month(3), year(4), timeRange(5);

    private Integer range;

    EnumTimeStage(Integer range) {
        this.range = range;
    }

    public Integer getRange() {
        return range;
    }

    public void setRange(Integer range) {
        this.range = range;
    }

    public static EnumTimeStage getTimeStage(Integer val) {
        return Arrays.stream(EnumTimeStage.values()).filter(item -> item.range.equals(val))
                .findFirst().orElse(null);
    }
}
